Computed attributes

Computed attributes differ from normal attributes in that their value is not a constant but is calculated using an expression that can contain numerical values, parameters, and variables.

On the Component Modeller tab, in the Component Model group, selecting Computed Attributes opens the Edit Computed Attributes dialog where you can manage the computed attributes of the GDL component that you are currently editing.

In the upper part of the dialog you can create and modify attributes.

  • Attributes – Select the attribute to edit.
  • Name – Enter a name for a new attribute or modify the name of an existing attribute.
  • Expression – Enter the expression to use.
  • Associated Comment – Describe the purpose of the attribute.
  • New – Save a new attribute with the currently defined name.
  • Modify – Save the currently selected attribute. If you have modified the name, the name of the attribute is changed accordingly.
  • Remove – Delete the currently selected attribute.

In the About section you can view information on any attribute without making any changes to them. For example, you can select one of the parameters of an attribute to display the current value of that parameter in the text box. You can use this as reference information when defining an attribute.

  • Attributes – Select an existing attribute to view its calculated value and expression.
  • Parameters – Select a parameter of the component model to view its current value and comment.
  • Variables – Select a variable to view its calculated value and expression.
  • Functions – Select a built-in function to see a description of that function.

Example: Computed attribute for the mass of a box part

In this example we create a "Box" type primitive whose measurement values are parametrized using a variable that calculates the volume of the box and a computed attribute that calculates the mass of the box, based on volume and material density.

Do the following:

  1. Select Component Modeller > Parameters to create three Length-type parameters that define length, width, and height: "LEN", "WID", and "HEI".

  2. Select Insert > Box to create a box-shaped primitive. Use the parameters "LEN", "WID", and "HEI" to define the dimensions of the box.

  3. Select Component Modeller > Variables to create a variable "VOL" that calculates the volume of the box in cubic meters. In the expression, multiply the box dimensions together and divide the product by 1E9.

  4. Select Component Modeller > Computed Attributes to create a computed attribute "MAS" that calculates mass. In the expression, multiply VOL by density. Unit of density is expressed as kg/m3 for the steel S235J2G3.

    The reason why Component Modeller does not automatically compute mass properties is that usually you only model the exterior of the actual components, and not the interior. However, for GDL content of Plant Modeller plate objects Component Modeller automatically computes area properties and mass properties.

    When you enter expressions that deal with length quantities, keep in mind that the internal units are always millimeters. The internal unit for mass quantity is kilograms. The internal values of parameters that store length quantity are in millimeters. So, if you have parameters defined to be of quantity type Length, then in expressions where you compute mass using formula MAS = Volume*Density you have to make sure that the internal value of volume is expressed in correct units regarding the density value.